<?php

/**
 * SignoVital filter form base class.
 *
 * @package    sibi-salud
 * @subpackage filter
 * @author     SIBI <sibiud@gmail.com>
 */
abstract class BaseSignoVitalFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'cita_medica_id'          => new sfWidgetFormPropelChoice(array('model' => 'CitaMedica', 'add_empty' => true)),
      'peso'                    => new sfWidgetFormFilterInput(),
      'talla'                   => new sfWidgetFormFilterInput(),
      'tension_arterial'        => new sfWidgetFormFilterInput(),
      'frecuencia_cardiaca'     => new sfWidgetFormFilterInput(),
      'frecuencia_respiratoria' => new sfWidgetFormFilterInput(),
      'temperatura_corporal'    => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'cita_medica_id'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'CitaMedica', 'column' => 'id')),
      'peso'                    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'talla'                   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'tension_arterial'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'frecuencia_cardiaca'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'frecuencia_respiratoria' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'temperatura_corporal'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('signo_vital_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'SignoVital';
  }

  public function getFields()
  {
    return array(
      'id'                      => 'Number',
      'cita_medica_id'          => 'ForeignKey',
      'peso'                    => 'Number',
      'talla'                   => 'Number',
      'tension_arterial'        => 'Number',
      'frecuencia_cardiaca'     => 'Number',
      'frecuencia_respiratoria' => 'Number',
      'temperatura_corporal'    => 'Number',
    );
  }
}
